<?php


namespace App\Http\Controllers\Order;


use App\Http\Controllers\Controller;
use App\Http\Searchs\Order\InventorySearch;
use App\Repositories\OrderCustoms;

class InventoryController extends Controller
{
    /**
     * @var OrderCustoms
     */
    private $customs;

    /**
     * InventoryController constructor.
     * @param OrderCustoms $customs
     */
    public function __construct(OrderCustoms $customs)
    {
        $this->customs = $customs;
    }


    /**
     * @param InventorySearch $search
     * @return \Illuminate\Http\JsonResponse
     */
    public function index(InventorySearch $search)
    {
        return $this->response(
            $this->customs->paginate($search->toArray())
        );
    }

    /**
     * @param $id
     * @return \Illuminate\Http\JsonResponse
     * @throws \Throwable
     */
    public function update($id){
        return $this->response(
            $this->customs->sendCustoms($id)
        );
    }

    /**
     * @param $id
     * @return \Illuminate\Http\JsonResponse
     * @throws \Throwable
     */
    public function show($id){
        return $this->response(
            $this->customs->show($id)
        );
    }
}
